<template>
  <wx-open-launch-weapp
    style="
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 50px;
      overflow: hidden;
      background: transparent;
    "
    v-if="isWx"
    username="gh_a82a71d44837"
    :path="path"
  >
    <div v-is="'script'" type="text/wxtag-template">
      <button style="border: none; background: transparent">&nbsp;</button>
    </div>
  </wx-open-launch-weapp>

  <footer
    class="
      fixed
      bottom-0
      z-30
      inset-x-0
      h-[50px]
      px-3
      bg-white
      border-t
      flex
      items-center
      justify-between
    "
    :class="isWx ? 'pointer-events-none' : ''"
    @click="$openApp"
  >
    <div
      class="
        flex flex-col
        justify-center
        text-red-500
        font-semibold
        text-center
      "
    >
      <div class="">
        <i>￥</i>
        <span class="text-xl ml-1">{{ $formatMoney(goods.price) }}</span>
      </div>
      <label class="text-xs"> 已减{{ maxCut }} </label>
    </div>
    <div class="flex flex-col justify-center text-center">
      <van-icon name="service-o" class="!text-xl" />
      <label class="text-xs"> 客服 </label>
    </div>
    <div class="flex flex-col justify-center text-center">
      <i class="iconfont icon-share1 !text-xl"></i>
      <label class="text-xs"> 分享赚 </label>
    </div>
    <button
      class="
        bg-gradient-to-r
        from-[#FF8730]
        to-[#FF0E00]
        px-10
        py-2
        rounded
        text-white text-lg
      "
    >
      立即购买
    </button>
  </footer>
</template>

<script>
import wxLaunch from '../../components/wxLaunch.vue'

export default {
  props: ['goods', 'path'],
  inject: ['isWx'],
  components: { wxLaunch },

  computed: {
    maxCut() {
      return this.$formatMoney(
        this.goods.pt_cuts_max_value + this.goods.seller_cuts_max_value,
      )
    },
  },
  methods: {
    onClick() {
      console.log(22222)
    },
  },
}
</script>

<style>
</style>